<?php namespace App\Domain\Lendhist\Service;


use App\Domain\Lendhist\Model\Lendhist;

class LendhistServiceImpl implements LendhistService
{
    public function updateLendHistByBookId($bookid,$doorid,$status){

        return Lendhist::where('BookID',$bookid)
            ->where('BookState',Lendhist::STATUS_0)
            ->update([
                     'ReturnDoorID' => $doorid,
                     'BookState' => $status,
                     'ReturnDate' => time()
            ]);
    }

    public function insertLendHist($BookID,$ReaderID,$LendDoorID){
        return Lendhist::create([
            'BookID' =>$BookID,
            'ReaderID' =>$ReaderID,
            'LendDoorID' =>$LendDoorID,
            'LendDate' =>time(),

        ]);

    }

}